<?php
class Document_types_model extends CI_Model {

    var $id = '';
    var $name = '';
    var $description = '';
    private $_tabla = 'document_types';

    function __construct() {
        // Call the Model constructor
        parent::__construct();
    }

    public function getAll()
    {
        $this->db->select();
        $query = $this->db->get($this->_tabla);
        return $query->result();
    }
    
    public function select_guide_sale(){
        $query = $this->db->query("SELECT * FROM `document_types` WHERE `id`=3");
        $rs = $query = $query->result();
        return $rs;
    }


    public function generanum()
    {
       $query = $this->db->query('SELECT * FROM sales ORDER BY document_code DESC LIMIT 1;');
       $rs = $query = $query->result();
       return $rs;
    }
    
    public function generanum_transfer()
    {
       $query = $this->db->query('SELECT * FROM transfer ORDER BY document_code DESC LIMIT 1;');
       $rs = $query = $query->result();
       return $rs;
    }
    
    
    public function select_guide_shop(){
        $query = $this->db->query("SELECT * FROM `document_types` WHERE `id`=4");
        $rs = $query = $query->result();
        return $rs;
    }
    
    public function generanum_shop()
    {
       $query = $this->db->query('SELECT document_code FROM shop ORDER BY document_code DESC LIMIT 1;');
       $rs = $query = $query->result();
       return $rs;
    }
}